using System.Collections.Generic;

public static class ShopInfoMgr
{
	private static string FILE_PATH = "Cfg/Shop";

	private static List<ShopInfo> _shopInfos = new List<ShopInfo>();

	private static Dictionary<int, int> _buyCount = new Dictionary<int, int>();

	public static List<ShopInfo> shopInfos => _shopInfos;

	public static void Load()
	{
		_shopInfos = Utils.LoadXML<ShopInfo>(FILE_PATH);
	}

	public static ShopInfo GetInfo(int infoId)
	{
		for (int i = 0; i < _shopInfos.Count; i++)
		{
			if (_shopInfos[i].id == infoId)
			{
				return _shopInfos[i];
			}
		}
		return null;
	}

	public static int AddBuyCount(int id)
	{
		if (_buyCount.ContainsKey(id))
		{
			int num = _buyCount[id];
			_buyCount[id] = num + 1;
		}
		else
		{
			_buyCount[id] = 1;
		}
		return _buyCount[id];
	}

	public static int GetBuyCount(int id)
	{
		if (_buyCount.ContainsKey(id))
		{
			return _buyCount[id];
		}
		return 0;
	}
}
